<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Sets the location of the Web service to use</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="soapclient.setcookie.html">SoapClient::__setCookie</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="soapclient.setsoapheaders.html">SoapClient::__setSoapHeaders</a></div>
 <div class="up"><a href="class.soapclient.html">SoapClient</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="soapclient.setlocation" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">SoapClient::__setLocation</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.0.1)</p><p class="refpurpose"><span class="refname">SoapClient::__setLocation</span> &mdash; <span class="dc-title">Sets the location of the Web service to use</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-soapclient.setlocation-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><strong>SoapClient::__setLocation</strong></span>
    ([ <span class="methodparam"><span class="type">string</span> <code class="parameter">$new_location</code></span>
  ] )</div>

  <p class="para rdfs-comment">
   Sets the endpoint URL that will be touched by following SOAP requests. This is equivalent to 
   specifying the <em>location</em> option when constructing the SoapClient.
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    Calling this method is optional.  The SoapClient uses the endpoint from
    the WSDL file by default.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 parameters" id="refsect1-soapclient.setlocation-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">new_location</code></em></dt>

     <dd>

      <p class="para">
       The new endpoint URL.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-soapclient.setlocation-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   The old endpoint URL.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-soapclient.setlocation-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-5202">
    <p><strong>Example #1 <span class="function"><strong>SoapClient::__setLocation()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$client&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">SoapClient</span><span style="color: #007700">(</span><span style="color: #DD0000">'http://example.com/webservice.php?wsdl'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$client</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">__setLocation</span><span style="color: #007700">(</span><span style="color: #DD0000">'http://www.somethirdparty.com'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$old_location&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$client</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">__setLocation</span><span style="color: #007700">();&nbsp;</span><span style="color: #FF8000">//&nbsp;unsets&nbsp;the&nbsp;location&nbsp;option<br /><br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">$old_location</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程的输出类似于：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
http://www.somethirdparty.com
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-soapclient.setlocation-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="methodname"><a href="soapclient.soapclient.html" class="methodname" rel="rdfs-seeAlso">SoapClient::SoapClient()</a> - SoapClient constructor</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="soapclient.setcookie.html">SoapClient::__setCookie</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="soapclient.setsoapheaders.html">SoapClient::__setSoapHeaders</a></div>
 <div class="up"><a href="class.soapclient.html">SoapClient</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
